﻿using Sundry.IBLL;
using Sundry.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Sundry.BLL
{
    public class BrandService : BaseService<Brand>, IBrandService
    {
        public override void SetCurrentRepository()
        {
            CurrentRepository = _dbSession.BrandRepository;
        }

        /// <summary>
        /// 获取品牌列表
        /// </summary>
        /// <param name="brandName">品牌名称</param>
        /// <param name="nowNum">当前最大数字</param>
        /// <param name="pageSize">长度</param>
        /// <param name="rowCount">总数</param>
        /// <returns>品牌列表</returns>
        public IQueryable<dynamic> LoadBradnList(string brandName, int nowNum, int pageSize, out int rowCount)
        {
            return _dbSession.BrandRepository.LoadBradnList(brandName, nowNum, pageSize, out rowCount);
        }
        /// <summary>
        /// 查找符合条件的第一个品牌
        /// </summary>
        /// <param name="whereLamda">查询条件</param>
        /// <returns>符合条件的第一个品牌</returns>
        public Brand SelectFirstBrand(Expression<Func<Brand, bool>> whereLamda)
        {
            return _dbSession.BrandRepository.SelectFirstBrand(whereLamda);
        }
    }
}
